<script>
function timeDate(time){
    var nowTime = new Date
    var oldTime = new Date(time)
    var times = (nowTime.getTime()-oldTime.getTime())/1000
    if(time < 10){
        return'刚刚'
    }else if(times>=10&&times<60){
        return parseInt(times)+'秒前'
    }else if(times>=60&&times<3600){
        return parseInt(times/60)+'分钟前'
}    else if(times>=3600&&times<=86400){
    return parseInt(times/3600)+'小时前'
}    else if(times>=86400){
    return parseInt(times/86400)+'天前'
}
}
   console.log(timeDate("2021-11-26 10:41:01"))
</script>